//
// Created by xili on 2024/8/30 11:05.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    string largestNumber(vector<int> &nums) {
        //b+a>a+b
        vector <string> v;
        for (auto &item: nums) {
            v.push_back(to_string(item));
        }
        sort(v.begin(), v.end(), [](string a, string b) { return a + b > b + a; });
        if (v[0] == "0") {
            return "0";
        }
        string ans = "";
        for (auto &item: v) {
            ans += item;
        }
        return ans;
    }
};